package corgi.consumer;

import corgi.IHello;
import corgi.rpc.invoke.config.Consumer;
import corgi.rpc.proxy.ConsumerProxyFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Created by huanghuanlai on 16/7/28.
 */
@Component
public class AA {

    @Bean
    public IHello hello(){
        return (IHello) consumerProxyFactory().create();
    }

    @Bean
    public ConsumerProxyFactory consumerProxyFactory(){
        ConsumerProxyFactory consumerProxyFactory = new ConsumerProxyFactory();
        Consumer consumer = new Consumer();
        consumer.unUseZK();
        consumer.setUrl("127.0.0.1:8888");
        consumerProxyFactory.setClassName("corgi.IHello");
        consumerProxyFactory.setConsumer(consumer);
        return consumerProxyFactory;
    }
}
